package com.hf.eagle.web.struts;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.beanutils.DynaBean;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import com.hf.eagle.domain.Accessory;
import com.hf.eagle.domain.UserInfo;
import com.hf.eagle.web.base.BaseAction;
import com.hf.eagle.web.base.SysConstant;

/**
 * 员工感言
 * @author xiaokeheng
 *
 */
public class StaffWordAction extends BaseAction {

	public ActionForward unspecified(ActionMapping mapping, ActionForm form, HttpServletRequest request,
			HttpServletResponse response) throws Exception {

		return this.view(mapping, form, request, response);
	}

	/**
	 * 员工感言显示
	 * @param mapping
	 * @param form
	 * @param request
	 * @param response
	 * @return
	 * @throws Exception
	 */
	public ActionForward view(ActionMapping mapping, ActionForm form, HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		DynaBean lazyForm = (DynaBean) form;
		String id = (String) lazyForm.get("id");
		
		//公司简介
		UserInfo userInfo=new UserInfo();
		userInfo.setUser_id(Long.parseLong(id));
		UserInfo userInfo2=getFacade().getUserInfoService().getUserInfo(userInfo);
		if (null != userInfo2) {
			Accessory acce = new Accessory();
			acce.setFile_level(SysConstant.MAIN_IMG);
			acce.getMap().put("mod_id", "2610");
			acce.getMap().put("record_id", userInfo2.getUser_id());
			acce = super.getFacade().getAccessoryService().getAccessory(acce);
			userInfo2.setAccessory(acce);
		}
		request.setAttribute("userInfo", userInfo2);
		return mapping.findForward("view");
	}

}